
package io.renren.utils.util.db.transaction;

import java.util.ConcurrentModificationException;

public interface Transaction 
//extends UserTransaction 
{

    final static int LOWEST_PRIORITY = 999;
    final static int NORMAL_PRIORITY = 499;
    final static int HIGHEST_PRIORITY = 0;
    
    /**
     * start a Transaction
     */
    public void begin() throws TransactionException;
    
    /**
     * commit a Transaction
     */
    void commit() throws TransactionException, ConcurrentModificationException;

    /**
     * rollback a Transaction
     */
    void rollback() throws TransactionException;


    /**
     * get the name of the Transaction
     */
    String getName();

    /**
     * set the Transaction name
     * @param name  Value to assign to name.
     */
    void setName(String name);

    /**
     * Add a Transaction (Unit Of Work) to this Transaction.
     * A Transaction can be a Transaction or a Transaction.
     *
     * @param tx The Transaction to be added
     */
    void addTransaction(Transaction tx);

    /**
     * Get a Transaction (Unit Of Work) from this Transaction
     *
     * @param name a value of type 'String'
     * @return a value of type 'Transaction'
     */
    Transaction getTransaction(String name);

    int getPriority();
}// Transaction







